package com.example.github.io.stream.filter;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;

/**
 * Java FilterOutputStream类实现了OutputStream类。它提供了不同的子类，
 * 如BufferedOutputStream和DataOutputStream，以提供额外的功能。所以它很少单独使用。
 */
public class FilterOutputStreamExample {
    public static void main(String[] args) throws IOException {
        File file = new File("D:/logs/test1.txt");
        FileOutputStream fis = new FileOutputStream(file);
        FilterOutputStream filterOutputStream = new FilterOutputStream(fis);
        String s = "this is a FilterOutputStreamExample";
        filterOutputStream.write(s.getBytes());
        filterOutputStream.flush();
        filterOutputStream.close();
        fis.close();
        System.out.println("FilterOutputStreamExample success ");
    }
}
